#ifndef NOTE_H
#define NOTE_H

#include <head/g_functionbase.h>
#include "common/baseresteditor.h"
#include "addnote.h"

namespace Ui {
class Note;
}

class Note : public BaseRestEditor
{
    Q_OBJECT

public:
    explicit Note(QWidget *parent = nullptr);
    ~Note();

    void generateMenu();
    void updateCategory();
    void updateListView();
    void updateDetailView();
    void customKeyEvent(QKeyEvent *event);
    void newItem();
    void editItem();
    void removeItem();

    void onReceivedObject(const QJsonObject &object);
    void onAddItem(const QJsonObject &obj);
    void onUpdateItem(const QJsonObject &obj);

private slots:
    void on_categories_currentTextChanged(const QString &category);
    void on_listView_doubleClicked(const QModelIndex &index);

private:
    Ui::Note *ui;

    int selectId;
    QString selectCategory,selectLabel;
    QStringList categories;
};

#endif // NOTE_H
